home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / p4 / p4-1_2a.lha / p4-1.2a / messages_f / sr_slave.f < prev    next >
Text File  |  1992-10-19  |  1KB  |  56 lines

  1.       subroutine fslave()
  2.  
  3.       include 'p4f.h'
  4.  
  5.       character*40 buffer
  6.       integer type, from, next, done, procid, length, buflen
  7.       integer numsl, retcde, recvlen
  8.       integer TAGCNT, TAGDAT, TAGEND
  9.       parameter (TAGCNT = 10)
  10.       parameter (TAGDAT = 20)
  11.       parameter (TAGEND = 30)
  12.  
  13.       numsl = p4ntotids() - 1
  14.       procid = p4myid()
  15.       buflen = 40
  16.  
  17.       print 200,'slave ',procid,' has started'
  18.  200  format(a,i2,a)
  19.       call p4flush
  20.  
  21.       if (procid .eq. numsl) then
  22.          next = 0
  23.       else
  24.          next = procid + 1
  25.       endif
  26.  
  27.       print 201,'slave ',procid,' next = ',next
  28.  201  format(a,i2,a,i2)
  29.       call p4flush
  30.  
  31.       length = 40
  32.       from = -1
  33.       type = TAGCNT
  34.       call p4recv(type,from,buffer,length,recvlen,retcde)
  35.       done = 0
  36.  
  37. 50    if (done .ne. 0) goto 100
  38.  
  39.          buffer = ' '
  40.          length = 40
  41.          from = -1
  42.          type = -1
  43.          call p4recv(type,from,buffer,length,recvlen,retcde)
  44.          if (type .eq. TAGEND) then
  45.             done = 1
  46.          else
  47.                 print *,'SLAVE ',procid,' sending msg to ',next
  48.                 call p4flush
  49.             call p4send(TAGDAT,next,buffer,recvlen,retcde)
  50.          endif
  51.          goto 50
  52.  
  53. 100   continue
  54.  
  55.       end
  56.